.type setjmp, @function
.type longjmp, @function
.global setjmp, longjmp
setjmp:
    lea 4(%esp), %edx
    movl %edx, (0)(%eax)
    movl %ebp, (4)(%eax)
    movl (%esp), %edx
    movl %edx, (8)(%eax)
    movl %edi, (12)(%eax)
    movl %esi, (16)(%eax)

    pushf
    pop (20)(%eax)

    mov %cs, (22)(%eax)
    mov %ds, (24)(%eax)
    mov %es, (26)(%eax)
    mov %ss, (28)(%eax)
    movl $0, %eax
    ret

longjmp:
    cli
	movl (0)(%eax), %esp
	movl (4)(%eax), %ebp
	movl (8)(%eax), %edx
    # mov (22)(%eax), %cx
	movl %edx, (%esp)
    movl (12)(%eax), %edi
    movl (16)(%eax), %esi

    push (20)(%eax)
    popf

    # mov (22)(%eax), %cs
    mov (24)(%eax), %ds
    mov (26)(%eax), %es
    mov (28)(%eax), %ss

	movl $1, %eax
    sti
	ret
